Skip to content

Remove attrs dependency to improve import times#161

Merged
meshy merged 1 commit into
kraken-tech:mainfrom
RealOrangeOne:remove-attrs
Jun 9, 2026
Merged

Remove attrs dependency to improve import times#161
meshy merged 1 commit into
kraken-tech:mainfrom
RealOrangeOne:remove-attrs

Conversation

@RealOrangeOne

Copy link
Copy Markdown
Contributor

This shaves around 10ms (~18%) off the import time.

It removes the immutability of the exceptions, but as the exceptions are intended for dev and not to be handled, this trade-off is worthwhile.

I've left the attribute types in place, on the off chance they're useful. It does duplicate the types for potentially little/no gain so also happy to remove.

@RealOrangeOne RealOrangeOne requested a review from a team as a code owner May 20, 2026 16:02

@meshy meshy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heya! :)

Thanks for this!

I'm on board with the idea of removing attrs, but I'm not sure about the import-time being a good justification for it. Instead I think the main reason I'm keen to get this in is because it will make the work of integrating into Django easier later, if that ever comes to fruition.

Can I please ask you to remove references to timing from the reasoning for this change (including in the commit message), and focus on that other benefit instead?

Thank you!

Comment thread CHANGELOG.md Outdated
- Exceptions raised through `transaction_if_not_already`
when it was called from inside an existing transaction
will no longer invalidate the outer transaction's context.
- Remove `attrs` dependency to improve import time.

@meshy meshy Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: I'd like to change the wording here to remove the reasoning. I think it's sufficient to say Removed `attrs` dependency.

Comment thread src/django_subatomic/db.py Outdated
Comment on lines 326 to 327
database: str

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you noted, these annotations aren't useful any more. Can I please ask you to remove them?

It removes the immutability of the exceptions, but as the exceptions are
intended for dev and not to be handled, this trade-off is worthwhile.
@RealOrangeOne RealOrangeOne requested a review from meshy June 9, 2026 13:04
@meshy meshy merged commit 4f3c611 into kraken-tech:main Jun 9, 2026
8 checks passed
@meshy

meshy commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Thank you! ❤️

@RealOrangeOne RealOrangeOne deleted the remove-attrs branch June 10, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants